﻿#region Copyright (c) 2008 plexBB Team

/*  Copyright (c) 2008 plexBB Team
 *  
 *  This file is free software: you may copy, redistribute and/or modify it  
 *  under the terms of the GNU General Public License as published by the  
 *  Free Software Foundation, either version 2 of the License, or (at your  
 *  option) any later version.  
 *  
 *  This file is distributed in the hope that it will be useful, but  
 *  WITHOUT ANY WARRANTY; without even the implied warranty of  
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
 *  General Public License for more details.  
 *  
 *  You should have received a copy of the GNU General Public License  
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */

#endregion

// ReSharper disable ConvertToAutoProperty

using System.Data.Linq;

namespace PlexBB.Data
{
    public class Forum : PasswordProtectedEntity
    {
#pragma warning disable 649
        private readonly EntitySet<Forum> _forums = new EntitySet<Forum>();
        private string _description;
        private int _forumID;
        private ForumType _forumType;
        private string _imageUrl;
        private string _name;
        private EntityRef<Forum> _parentForum;
        private int? _parentID;
        private byte[] _password;
        private byte[] _passwordSalt;
        private int _position;
        private ForumStatus _status;
        private string _link;
#pragma warning restore 649

        protected override byte[] Password
        {
            get { return _password; }
            set { _password = value; }
        }

        protected override byte[] PasswordSalt
        {
            get { return _passwordSalt; }
            set { _passwordSalt = value; }
        }

        public int ForumID
        {
            get { return _forumID; }
            set { _forumID = value; }
        }

        public int? ParentID
        {
            get { return _parentID; }
            set { _parentID = value; }
        }

        public int Position
        {
            get { return _position; }
            set { _position = value; }
        }

        public string Name
        {
            get { return _name ?? string.Empty; }
            set { _name = value; }
        }

        public string Description
        {
            get { return _description ?? string.Empty; }
            set { _description = value; }
        }

        public ForumType ForumType
        {
            get { return _forumType; }
            set { _forumType = value; }
        }

        public ForumStatus Status
        {
            get { return _status; }
            set { _status = value; }
        }

        public string ImageUrl
        {
            get { return _imageUrl ?? string.Empty; }
            set { _imageUrl = value; }
        }

        public string Link
        {
            get { return _link ?? string.Empty; }
            set { _link = value; }
        }

        public EntitySet<Forum> Forums
        {
            get { return _forums; }
            set { _forums.Assign(value); }
        }

        public Forum ParentForum
        {
            get { return _parentForum.Entity; }
            set { _parentForum.Entity = value; }
        }
    }
}